Skip to content

test(desktop): scope slash-menu mutation watch to the menu and read once - #3737

Merged
Astro-Han merged 1 commit into
apache:mainfrom
yunaremaia:test/scope-slash-menu-mutation-watch
Aug 25, 2026
Merged

test(desktop): scope slash-menu mutation watch to the menu and read once#3737
Astro-Han merged 1 commit into
apache:mainfrom
yunaremaia:test/scope-slash-menu-mutation-watch

Conversation

@yunaremaia

Copy link
Copy Markdown
Contributor

Summary

Implements the direction suggested in #3727 for the slash-command-menu flake:

  • The mutation watch now observes the menu itself (subtree) plus its parent, instead of document.body with subtree: true. Overlays elsewhere in the document (toasts, tooltips, other popups) can no longer contribute removals to the counter.
  • The observers disconnect once the refresh rounds have settled (visibility wait + one frame pair), and the count is read exactly once. The old expect.poll on a monotonically increasing counter could never retry into success - it only added 3s of latency before failing.
  • No retries are added; the config's fail-loudly stance (retries: 0) is untouched.

Why this is safe

The guarded property (#2667) is "a same-content projection refresh must not tear down the skills group or the listbox". The new watch counts exactly two things during the refresh window: a [role="group"] removed inside the menu, or the listbox element itself removed. Anything else was noise under the old predicate, which counted any removed element containing a listbox/group anywhere in the document.

Verified locally under xvfb (Electron 43):

  • Spec green: 5/5 tests, six consecutive runs of the target test all passed.
  • Regression check: temporarily injecting a group teardown right after arming makes the rewritten test fail with removals = 1 - the narrowing does not mute the failure mode the test exists to catch.

Note on artifacts

The trace/video artifacts from the five failing runs linked in the issue had already expired, so I could not diff them directly; the code-path analysis above is the basis for the window-scope reading.

Fixes #3727

The watch armed on document.body with subtree:true for the whole poll
window and counted any removed element containing a listbox or group, so
an unrelated overlay unmounting within 3s reported the apache#2667 regression.
Because the counter only increases, expect.poll could never retry into
success - it added latency, not tolerance.

Scope it to the guarded property instead: one observer on the listbox
(subtree) catches a group torn down inside it, one on its parent catches
the whole listbox being replaced. Disconnect after the refresh rounds
settle and read the count once.

Verified locally (xvfb): spec green 5/5 across six runs; an injected
group teardown during the window still fails the test (removals=1), so
the narrowing does not mute the regression it guards.

Fixes apache#3727

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this head and found no blocking issues. No P0-P2.

Checks on 7dfa534 are test: success.

简体中文该头未发现阻断问题。

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE — 7dfa534, test-only fix for #3727, no P0-P2, observer correctly narrowed. See prior COMMENT 5014208436.

@Astro-Han
Astro-Han merged commit c25850f into apache:main Aug 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: slash-command-menu "keeps its container and skills group across projection refreshes"

2 participants